#coding:utf-8
'''
create on 2017-04-20

@author:sandy
'''

#============================================通信方式===================================================
CLIENT_WEB_SOCKET               = 0
CLIENT_TCP_SOCKET               = 1

GAME_ID                         = 0
PROTOCOL_STR_ENCODING           = 'utf-8'
ACCOUNT_LEN_MIN                 = 5
ACCOUNT_LEN_MAX                 = 20
NICKNAME_LEN_MIN                = 1
NICKNAME_LEN_MAX                = 15
PASSWD_LEN_MIN                  = 6
PASSWD_LEN_MAX                  = 16
DEVICEID_LEN_MIN                = 8
DEVICEID_LEN_MAX                = 64

ORDER_STATE_CREATE              = 0
ORDER_STATE_PAYSUCESS           = 1
ORDER_STATE_FIN                 = 2

PROP_CHANGE_DEFAUTL             = 0 #默认
PROP_CHANGE_CHAGE               = 1 #充值
PROP_CHANGE_USE                 = 2 #正常使用
PROP_CHANGE_BACK                = 3 #返还
PROP_CHANGE_GIVE_TO_ME          = 4 #别人赠送给自己
PROP_CHANGE_GIVE_TO_OTHER       = 5 #自己赠送给别人


REMOTE_LOG_TEYE_PROP            = 1

#============================================ERROR_CODE===================================================
ERR_OK                          = 1000
ERR_INVALID_ACCOUNT             = 1001
ERR_INVALID_NICKNAME            = 1002
ERR_INVALID_PASSWD              = 1003
ERR_DATABASE                    = 1004
ERR_ACCOUNT_NOT_EXIST           = 1005
ERR_PASSWD_WRONG                = 1006
ERR_ACCOUNT_EXIST               = 1007
ERR_SESSION_WRONG               = 1008
ERR_GATE_BUSY                   = 1009
ERR_INVALID_DEVICEID            = 1010
ERR_WAIT_AND_RETRY              = 1011
ERR_THIRD_LOGIN_ERROR           = 1012
ERR_SERVER_EXIST                = 1013
ERR_RELOGIN                     = 1014
ERR_ALREADY_IN_HALL             = 1015
ERR_UID_WRONG                   = 1016
ERR_HALL_IS_FULL                = 1017
ERR_TABLE_IS_FULL               = 1018
ERR_USER_HAS_TABLE              = 1019
ERR_LOGIN2MGR_SID_FAIL          = 1020
ERR_LOGIN2MGR_OTH_FAIL          = 1021



ERR_MJ_CREATETABLE_MAXROUND     =   1260 #麻将创建房间 最大局数错误
ERR_MJ_CREATETABLE_TABLEMODEL   =   1261 #麻将创建房间 房间模式选择错误
ERR_MJ_CREATETABLE_PLAYMODEL    =   1262 #麻将创建房间 玩法选择错误
ERR_MJ_CREATETABLE_CARDNOTENOUGH =  1263 #麻将创建房间 房卡不足
ERR_MJ_TABLE_NOTEXIT             =  1264 #桌子不存在
ERR_MJ_PLAYER_IN_KICK            =  1265 #玩家被关进小黑屋
ERR_MJ_TABLE_ISFULL              =  1266 #房间已满
ERR_MJ_USER_HASINTABLE           =  1267 #玩家已经进入桌子
#ERR_MJ_USER_HASCRATEtABLE        =  1268 #玩家已经创建了桌子
ERR_MJ_NO_GAMESERVER             =  1269 #没有可用的游戏服务器

ERR_MJ_DISBAND_TABLE_ERROR       =  1270 #解散房间失败
ERR_MJ_OWNER_KICK_USER_FAIL      =  1271 #踢出玩家失败
ERR_MJ_CREATETABLE_GS_BUSY       =  1272 #创建桌子 game服务器未能及时返回数据
ERR_MJ_GIVE_PROP_EACHOTHER       =  1273 #赠送者跟接收者不能是同一个人
ERR_HALL_NOT_EXIST               =  1274
ERR_NO_TABLE                     =  1275
ERR_SYS_MAINTAIN                 =  1276
ERR_TABLEIDSTR_ERR               =  1277  


#==========================================counter========================================================
COUNTER_GATE2CENTER_INTERVAL    = 10
COUNTER_CENTER2LOIN_INTERVAL    = 15
COUNTER_CENTER_SAVE_INTERVAL    = 60

COUNTER_LOGIN                   = 1001
COUNTER_LOGIN_SUC               = 1002
COUNTER_REGISTER                = 1003
COUNTER_REGISTER_SUC            = 1004
COUNTER_ONLINE_USER_COUNT       = 1005
COUNTER_GAME_SERVER_RELOGIN     = 1006




CMD_KEEP_ALIVE                  = 1 #心跳
#==============================login<->center(100,200)=====================================
CMD_LG2CT_LOGIN = 101

CMD_CT2LG_LOGINSUC = 201
CMD_CT2LG_GATE_UPDATE = 202
#==============================gate<->center(300,400)=====================================
CMD_GATE2CT_LOGIN                            = 301
CMD_GATE2CT_TRANS_PKT                        = 302
CMD_GATE2CT_REPORT_COUNTER                   = 303
CMD_GATE2CT_REPORT_ONLINE                    = 304


CMD_CT2GATE_LOGINSUC                         = 401
CMD_CT2GATE_GAME_UPDATE                      = 402
CMD_CT2GATE_TRANS_PKT                        = 403
CMD_CT2GATE_KICK_USER                        = 404


#==============================game<->center(500,600)=====================================
CMD_GAME2CT_LOGIN                            = 501
CMD_GAME2CT_HALL_INFO                        = 502
CMD_GAME2CT_CREATE_TABLE                     = 503
CMD_GAME2CT_ENTER_TABLE                      = 504
CMD_GAME2CT_CHECK_USER                       = 505
CMD_GAME2CT_USER_LOGIN                       = 506
CMD_GAME2CT_USER_LOGOUT                      = 507
CMD_GAME2CT_REPORT_HALL                      = 508
CMD_GAME2CT_TABLE_DISMISS                    = 509


CMD_CT2GAME_LOGINSUC                         = 601
CMD_CT2GAME_TRANS_PKT                        = 602
CMD_CT2GAME_CREATE_TABLE                     = 603
CMD_CT2GAME_ENTER_TABLE                      = 604
CMD_CT2GAME_CHECK_USER                       = 605
CMD_CT2GAME_KICK_USER                        = 606
CMD_CT2GAME_PROP                             = 607
CMD_CT2GAME_PROPERTY                         = 608
CMD_CT2GAME_INFO_END                         = 609

#==============================XXXX<->manager(700,800)====================================
CMD_XX2MGR_LOGIN                = 701
CMD_XX2MGR_GET_CONFIG           = 702
CMD_XX2MGR_EXCEPTION_LOG        = 703
CMD_XX2MGR_GET_CONFIG_END       = 704
CMD_XX2MGR_UPLOAD_CONFIG_FILE   = 705
CMD_XX2MGR_HOT_UPLOAD_FILE      = 706

CMD_MGR2XX_KEEP_ALIVE           = 801
CMD_MGR2XX_LOGIN_RET            = 802
CMD_MGR2XX_REMOTE_CFG           = 803
CMD_MGR2XX_REMOTE_PATCH         = 804
CMD_MGR2XX_LOG_LEVEL            = 805
CMD_MGR2XX_REMOTE_CFG_FIN       = 806
CMD_MGR2XX_UPLOAD_FILE_RET      = 807
CMD_MGR2XX_HOT_UPDATE_FILE      = 808

#==============================XXXX<->logserver(900,919)====================================
CMD_XX2LOG_LOGIN                = 901
CMD_XX2LOG_SAVE_DATA            = 902

CMD_LOG2XX_LOGIN                = 911
CMD_LOG2XX_SAVE                 = 912

#==============================Bill<->center(920,939)====================================
CMD_BILL2CT_LOGIN               = 921
CMD_BILL2CT_PAY_SUCESS          = 922
CMD_BILL2CT_PAY_FAILED          = 923

CMD_CT2BILL_LOGIN               = 931

#==============================Login<->LoginMgr(940,959)====================================
CMD_LG2LGM_LOGIN                = 941

CMD_LGM2LG_LOGIN                = 951
#==============================client<->login(1000,2000)=====================================
CMD_C2L_LOGIN                   = 1001
CMD_C2L_REGISTER                = 1002
CMD_C2L_WX_LOGIN                = 1003 #微信登录
CMD_C2L_AUTO_REGISTER           = 1004
CMD_C2L_TEST                    = 1005

CMD_L2C_LOGIN                   = 2001
CMD_L2C_REGISTER                = 2002
CMD_L2C_WX_LOGIN                = 2003 #微信登录
CMD_L2C_GATE_INFO               = 2004 #网关信息

#==============================client<->gate(3000,4000)=====================================
CMD_C2GATE_LOGIN                = 3001
CMD_C2GATE_LOGIN_TEST           = 3002

CMD_GATE2C_LOGIN                = 4001
CMD_GATE2C_KICK_USER            = 4002

#==============================client<->center(5000,6000)===================================
CMD_C2CT_BEGIN                  = 5000
CMD_C2CT_USER_LOGIN             = 5001
CMD_C2CT_USER_LOGIN_WECHAT      = 5002
CMD_C2CT_CREATE_TABLE           = 5005
CMD_C2CT_ENTER_TABLE            = 5006
CMD_C2CT_END                    = 5999


CMD_CT2C_USER_LOGIN             = 6001
CMD_CT2C_BASEINFO               = 6002
CMD_CT2C_PROP                   = 6003
CMD_CT2C_PROPERTY               = 6004
CMD_CT2C_CREATE_TABLE           = 6005
CMD_CT2C_ENTER_TABLE            = 6006

#==============================client<->game(7000,8000)=====================================
CMD_C2GAME_BEGIN                = 7000
CMD_C2GAME_LOGIN                = 7001
CMD_C2GAME_LOGOUT               = 7002
CMD_C2GAME_JOIN                 = 7003
CMD_C2GAME_END                  = 7999


CMD_GAME2C_LOGIN                = 8001
CMD_GAME2C_SELF_ENTER           = 8002
CMD_GAME2C_JOIN                 = 8003
CMD_GAME2C_OTHER_ENTER          = 8004
CMD_GAME2C_USER_LEAVE           = 8005
CMD_GAME2C_KICK                 = 8006

CMD_GAME2C_XIPAI                = 8011
CMD_GAME2C_FAPAI                = 8012






